package com.demo.minicat;

import java.io.IOException;
import java.io.OutputStream;

/**
 * @author: lipan
 * @date: 2021/9/29 21:51
 */

public class Response {

    private OutputStream outputStream;

    public Response(OutputStream outputStream) {
        this.outputStream = outputStream;

    }

    public void outPut(String content){
        try {
            outputStream.write(content.getBytes());
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    /**
     * 返回静态资源
     * @throws Exception
     */
    public void outputResource(String path) throws Exception{

        StaticResourceUtils.printStaticResource(outputStream,path);
    }
}
